//
//  UIAlertController+YCExtension.h
//  YCPublicDemo
//
//  Created by 董知樾 on 2017/5/18.
//  Copyright © 2017年 xinhuanwangluo. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface UIAlertController (YCExtension)

+ (instancetype)alertControllerWithTitle:(NSString *)title message:(NSString *)message;
+ (instancetype)actionSheetControllerWithTitle:(NSString *)title message:(NSString *)message;


/**
 添加一个确定类型的action alert和actionSheet都可以用。ps:cancel 只能有一个
 */
- (void)addDefaultAction:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
- (void)addCancelAction:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
- (void)addDestructiveAction:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;


/**
 添加一个确定类型的preferred的action仅限于alert。ps:cancel 只能有一个
 */
- (void)addPreferredDefaultAction:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
- (void)addPreferredCancelAction:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;
- (void)addPreferredDestructiveAction:(NSString *)title handler:(void (^)(UIAlertAction *action))handler;


/**
 addAction

 @param title title
 @param style UIAlertActionStyle
 @param preferred 是否是preferred，title加粗显示，UIAlertActionStyleCancel类型的action的title是加粗显示的，仅限于alert类型使用
 @param handler 点击事件的回调
 */
- (void)addActionWithTitle:(NSString *)title style:(UIAlertActionStyle)style preferred:(BOOL)preferred handler:(void (^)(UIAlertAction *action))handler ;


/**
 用于提示用户，只提供确定action，不需要点击事件回调
 
 @param title 提示语
 */
+ (void)alertTitleTip:(NSString *)title;


/**
 用于提示用户，提供确定和取消选项，有点击事件回调

 @param title title
 @param message message
 @param sure 确定的回调
 @param cancel 取消的回调
 */
+ (void)alertTipWithTitle:(NSString *)title message:(NSString *)message sure:(void (^)(UIAlertAction *action))sure cancel:(void (^)(UIAlertAction *action))cancel;


/**
 window.rootViewController showDetail
 */
- (void)show;

@end
